package com.itheima.interface_case.students_manager;

public class ClassManager extends StudentOperator {

    @Override
    public void printStudents() {
        System.out.println("===========打印所有学生信息===========");
        for (int i = 0; i < this.students.size(); i++) {
            Student student = this.students.get(i);
            System.out.println(student.getName() + " -> " + student.getSex() + " -> " + student.getScore());
        }
    }

    @Override
    public void printAvgScore() {
        System.out.println("===========打印平均成绩===========");
        int sum = 0;
        for (int i = 0; i < this.students.size(); i++) {
            Student student = this.students.get(i);
            sum += student.getScore();
        }
        System.out.println("所有学生平均成绩为：" + sum / this.students.size());
    }

}
